package com.servlet.servlet;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.servlet.entity.User;
import com.servlet.service.UserService;

/**
 * 获取用户列表
 * @author smfx1314
 *
 */
@WebServlet("/listUser.do")
public class UserServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//获取用户列表
		UserService userService=new UserService();
		List<User> list=userService.getListAll();
		System.out.println(list);
		request.setAttribute("list", list);
		request.getRequestDispatcher("/jsp/success.jsp").forward(request, response);
		
	}
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
